<script setup>
import { useRoute, useRouter } from "vue-router";
import {
  Document,
  Menu as IconMenu,
  Location,
  Setting,
  User,
} from '@element-plus/icons-vue';

const route = useRoute();
const router = useRouter();

const handleOpen = (key, keyPath) => {
  console.log(key, keyPath);
};

const handleSelect = (index) => {
  router.push(index);
};
</script>

<template>
  <el-row class="tac">
    <el-col>
      <h5 class="mb-2">学生管理系统</h5>
      <el-menu
          active-text-color="#ffd04b"
          background-color="#545c64"
          class="el-menu-vertical-demo"
          :default-active="route.path"
          text-color="#fff"
          @open="handleOpen"
          @select="handleSelect"
          :router="true"
      >
        <el-menu-item index="/home">
          <el-icon><Location /></el-icon>
          <span>首页</span>
        </el-menu-item>
        <el-menu-item index="/student">
          <el-icon><IconMenu /></el-icon>
          <span>学生管理</span>
        </el-menu-item>
        <el-menu-item index="/course">
          <el-icon><Document /></el-icon>
          <span>课程管理</span>
        </el-menu-item>
        <el-menu-item index="/grade">
          <el-icon><Setting /></el-icon>
          <span>成绩管理</span>
        </el-menu-item>
        <el-menu-item index="/user">
          <el-icon><User /></el-icon>
          <span>用户管理</span>
        </el-menu-item>
      </el-menu>
    </el-col>
  </el-row>
</template>

<style scoped>
.mb-2 {
  font-family: "Arial Black";
  font-size: 20px;
  color: #f9f9f9;
}
</style>
